<%@ page import="java.util.List"%>
<%@ page import="gmusic.ma.bo.ArtistMABean"%>

<jsp:include page="include/entete.jsp" flush="true">
	<jsp:param name="titre" value="Metal Archives" />
	<jsp:param name="sousTitre" value="Liste des groupes" />
</jsp:include>

<%
	List<ArtistMABean> artists = (List<ArtistMABean>) session
			.getAttribute("artists");
	List<String> premieresLettre = (List<String>) session
			.getAttribute("premieresLettre");
%>

<div class="table">
<table border="0" width="100%">
	<tr align="center">
		<td id="cell3" colspan="4">
		<%
			for (int i = 0; i < premieresLettre.size(); i++) {
		%> <a href="#<%=premieresLettre.get(i)%>"><%=premieresLettre.get(i)%></a>
		<%
			}
		%>
		</td>
	</tr>
</table>
</div>

<div class="table">
<table border="0" width="100%">
	<%
		String[] ligneCouleur = new String[] { "ligne1", "ligne2" };
		String lettre = "";
		for (int i = 0; i < artists.size(); i++) {

			// On saute une ligne pour chaque changement de lettre
			if (!lettre.equalsIgnoreCase(artists.get(i).getNom().substring(
					0, 1))) {
				lettre = artists.get(i).getNom().substring(0, 1);
	%>

	<thead>
		<tr class="thead">
			<th>MAID</th>
			<th><a name="<%=lettre%>"><%=lettre%></a></th>
			<th colspan="5">Actions</th>
		</tr>
	</thead>
	<%
		}
	%>
	<tbody>
		<tr class="<%=ligneCouleur[i % 2]%>">
			<td width="80">[<%=artists.get(i).getMaid()%>]</td>
			<td><a
				href="GMusic?cmd=AfficherReleasesMA&maid=<%=artists.get(i).getMaid()%>"><%=artists.get(i).getNom().toUpperCase()%></a></td>
			<td align="center"><a
				href="GMusic?cmd=ModifierArtistMA&maid=<%=artists.get(i).getMaid()%>"><img
				src="images/modifier.gif" border="0" /></a></td>
			<td align="center"><a
				href="GMusic?cmd=SupprimerArtistMA&maid=<%=artists.get(i).getMaid()%>"><img
				src="images/supprimer.gif" border="0" /></a></td>
			<td align="center"><a
				href="GMusic?cmd=MAJArtistMA&maid=<%=artists.get(i).getMaid()%>">MAJ</a></td>
			<td align="center"><%="<a href=\"ExporterMAArtist.gm?amaid="
						+ artists.get(i).getMaid() + "\">Exp</a>"%></td>
			<td align="center"><%=artists.get(i).existsInGM() ? "&nbsp;"
						: "<a href=\"GMusic?cmd=AjouterArtisteDepuisMA&maid="
								+ artists.get(i).getMaid() + "\">Add</a>"%></td>
		</tr>
		<%
			}
		%>
	</tbody>
	<tfoot>
		<tr class="tfoot">
			<td colspan="7"><%=artists.size()%> enregistrement(s)</td>
		</tr>
	</tfoot>
</table>
</div>

<jsp:include page="include/piedPage.jsp" flush="true" />